<template>
	<view>
		<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">选择流程模板</block>
		</cu-custom>
		<view class="wrap">
			<view class="page-box">
				<view class="order" v-for="(res, index) in dataList" :key="res.id">
					<view class="item">
						<view class="left">
							<image :src="res.goodsList.goodsUrl" mode="aspectFill"></image>
						</view>
						<view class="content">
							<view class="title u-line-2 text-bold">{{ res.goodsList.title }}</view>
							<view class="type">{{ res.goodsList.type }}</view>
							<view class="delivery-time">所属部门： {{ res.goodsList.bumen }}</view>
						</view>
					</view>
					<u-line color="#f1f1f1" margin="24rpx 0 15rpx 0"></u-line>
					<view class="bottom">
						<view>
							<view class="cu-avatar-group" style="padding-left: 24rpx;">
								<view class="cu-avatar round" v-for="(item,index) in avatar" :key="index" :style="[{ backgroundImage:'url(' + avatar[index] + ')' }]"></view>
							</view>
							<text class="text-blue text-shadow">参与人员:{{ res.goodsList.number }}人</text>
						</view>
						
						<view class="btnBox">
							<view @click="goDetail(res.id)" class="btn">查看</view>
						</view>
						<view class="btnBox">
							<view @click="goClass(res.id,res.goodsList.title)" class="evaluate btn">选择</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import request from "@/common/request.js"
export default {
	data() {
		return {
			percent: 50,
			activeColor: '#0081ff',
			striped: false,
			stripedActive: false,
			
			avatar: [
				this.$request22.baseUrl1+'/Resource/sg/avatar/1.png',
				this.$request22.baseUrl1+'/Resource/sg/avatar/2.png',
				this.$request22.baseUrl1+'/Resource/sg/avatar/3.png',
				this.$request22.baseUrl1+'/Resource/sg/avatar/4.png',
			],
			dataList: [
			],
		};
	},
	onLoad() {
		let that=this
		that.getData()
	},
	computed: {
	},
	methods: {
		getData(){
			let that=this
			let opts = {
				url: 'Workflow/GetETWorkFlowMouldInfoList',
				method: 'get'
			};
			//准备提交
			uni.showLoading({
				title:'加载中...'
			})
			that.dataList=[]
			request.httpTokenRequest(opts).then(res => {
				uni.hideLoading();
				if(res.data.code == 1){
					if(res.data.data.length>0){
						for(let i=0;i<res.data.data.length;i++){
							let entity=res.data.data[i]
							let newEntity={}
							newEntity.id=entity.Entity.Id
							let newGoodList={}
							newGoodList.goodsUrl=this.$request22.baseUrl1+'/Resource/sg/flow/web3.png'
							newGoodList.title=entity.Entity.MouldName
							newGoodList.type=entity.Entity.Remarks
							newGoodList.bumen=entity.Entity.DepartmentIdName
							newGoodList.number=entity.Entity.IsWorkCount
							newEntity.goodsList=newGoodList
							that.dataList.push(newEntity)
						}
					}
				}
				else{
					uni.showToast({ title: res.data.msg, icon: 'none' });
				}
			});	
		},
		goDetail(id){
			uni.navigateTo({
				url: '/pages-workflow/tempInfo?tempId='+id+'&isChoose=0'
			})
		},
		goClass(id,title){
			uni.navigateTo({
				url: '/pages-workflow/tempInfo?tempId='+id+'&isChoose=1'
			})
		}
	}
};
</script>

<style lang="scss" scoped>
/* #ifndef H5 */
page {
	height: 100%;
	background-color: #f2f2f2;
}
/* #endif */
</style>

<style lang="scss" scoped>
	
.order {
	width: 710rpx;
	background-color: #ffffff;
	margin: 20rpx auto;
	border-radius: 20rpx;
	box-sizing: border-box;
	padding: 20rpx;
	font-size: 28rpx;
	.top {
		display: flex;
		justify-content: space-between;
		.left {
			display: flex;
			align-items: center;
			.store {
				margin: 0 10rpx;
				font-size: 34rpx;
				font-weight: bold;
			}
		}
		.right {
			color: $u-type-warning-dark;
			.progressBox{
				width: 150rpx;
				float: right;
			}
		}
	}
	.item {
		display: flex;
		margin: 20rpx 0 0;
		.left {
			margin-right: 20rpx;
			image {
				width: 200rpx;
				height: 130rpx;
				border-radius: 10rpx;
			}
		}
		.content {
			.title {
				font-size: 28rpx;
				line-height: 45rpx;
			}
			.type {
				margin: 6rpx 0;
				font-size: 24rpx;
				color: $u-tips-color;
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 3;
				line-clamp: 3;
				-webkit-box-orient: vertical;
			}
			.delivery-time {
				color: #0081ff;
				font-size: 24rpx;
			}
		}
		.right {
			margin-left: 10rpx;
			padding-top: 20rpx;
			text-align: right;
			.decimal {
				font-size: 24rpx;
				margin-top: 4rpx;
			}
			.number {
				color: $u-tips-color;
				font-size: 24rpx;
			}
		}
	}
	.total {
		margin-top: 20rpx;
		text-align: right;
		font-size: 24rpx;
		.total-price {
			font-size: 32rpx;
		}
	}
	.bottom {
		line-height: 70rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.btnBox{
			width: 150rpx;
			display: flex;
			justify-content: space-between;
			.btn {
				line-height: 52rpx;
				width: 140rpx;
				border-radius: 12rpx;
				border: 2rpx solid $u-tips-color;
				font-size: 26rpx;
				text-align: center;
				color: $u-tips-color;
			}
			.evaluate {
				color: $u-type-primary;
				border-color: $u-type-primary;
			}
		}
	}
}
.centre {
	text-align: center;
	margin: 200rpx auto;
	font-size: 32rpx;
	image {
		width: 300rpx;
		border-radius: 50%;
		margin: 0 auto;
	}
	.tips {
		font-size: 24rpx;
		color: #999999;
		margin-top: 20rpx;
	}
	.btn {
		margin: 80rpx auto;
		width: 200rpx;
		border-radius: 32rpx;
		line-height: 64rpx;
		color: #ffffff;
		font-size: 26rpx;
		background: linear-gradient(270deg, #1cbbb4 0%, #0081ff 100%);
	}
}
.wrap {
	display: flex;
	flex-direction: column;
	height: calc(100vh - var(--window-top));
	width: 100%;
}
.swiper-box {
	flex: 1;
}
.swiper-item {
	height: 100%;
}
</style>

